nums = [1,2,3,4,5,6,7]
k = 3
def rotate(nums, k) -> None:
    """
    Do not return anything, modify nums in-place instead.
    """
    #向后整体移动几个位置
    nums1=nums[len(nums)-k:]

    i=len(nums)-k-1
    index=1
    while i>=0:
        nums[len(nums)-index]=nums[i]
        i-=1
        index+=1

    for i in range(k):
        nums[i]=nums1[i]
    print(nums)


rotate(nums,k)
